package cn.edu.scau.cmi.linhongxin.client;


import cn.edu.scau.cmi.linhongxin.orm.hibernate.HibernateSessionFactory;
import cn.edu.scau.cmi.linhongxin.spring.domain.*;
import javafx.application.Application;
import javafx.event.EventHandler;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
import javafx.stage.WindowEvent;

public class SpringClient extends Application{
/*	private static Teacher liangzaoqing;
	private static Student zhangsan;
	public SpringClient() {
		
	}
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		ApplicationContext applicationContext =new ClassPathXmlApplicationContext("applicationContext.xml");
		Student student1 = (Student) applicationContext.getBean("zhangsan");
		System.out.println(student1.getName() + "的毕业设计指导导师是：" + student1.getTutor());

	}
*/
	public static void main(String[] args) {
		launch(args);
	}
	
	@Override
	public void start(Stage primaryStage) throws Exception {
		Parent root = FXMLLoader.load(getClass().getResource("/cn/edu/scau/cmi/linhongxin/spring/view/SpringStage.fxml"));		
		primaryStage.setTitle("Spring Client");
		primaryStage.setScene(new Scene(root));
		primaryStage.setOnCloseRequest(new EventHandler<WindowEvent>() {
			@Override
			public void handle(WindowEvent event) {
				HibernateSessionFactory.getSessionFactory().close();				
			}			
		});
		primaryStage.show();
	}
}
